UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZWGsRdJTE3O1dZEb2jcVEf0S/7qAhql/47949ry5obQ='
WHERE
key_id = '9233d81c65a1229304d9aa3fa2e0a62c9cccf1102a1ba396f225adc64b7ed441'
AND (
token = 'ZWGsRdJTE3O1dZEb2jcVEf0S/7qAhql/47949ry5obQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)