UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EGSXAtHkWdvC00wpX9j0a99c5D8xPnXb5f+ImrKpbBo='
WHERE
key_id = 'b18358d01e6f04f162eba1084f797e58f93a8b182d77d370004bcb6f23a7db42'
AND (
token = 'EGSXAtHkWdvC00wpX9j0a99c5D8xPnXb5f+ImrKpbBo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)