UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lWtF9VBAPe4V9r1U7v5SGFRkbEbNqYloKUfpFCMJAkE='
WHERE
key_id = '4877df7de1c69782640c40464d43b1f40cd23a4bd1f03d8dee493adf705ff80f'
AND (
token = 'lWtF9VBAPe4V9r1U7v5SGFRkbEbNqYloKUfpFCMJAkE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)