UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iUG8Vbu81kfAjN86h26DlQRUbnfmDBYuKVdmAoAQKIY='
WHERE
key_id = 'c3a1a7469ccb4345537738572bd0eb1e2205b553e45273bd6461de160c0659fe'
AND (
token = 'iUG8Vbu81kfAjN86h26DlQRUbnfmDBYuKVdmAoAQKIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)