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