UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dZL5ursJrgANkgyc/wmx0vrFZMtkQsMW615ILHGV8Yo='
WHERE
key_id = 'f0436c567d5166ee91d2806574a48449e99840b71e1de60b5958fb4e93398f0d'
AND (
token = 'dZL5ursJrgANkgyc/wmx0vrFZMtkQsMW615ILHGV8Yo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)