UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EfiHNVfEux2m2o6E3abap7Aynab1Jg3D0m+jzPT6aVs='
WHERE
key_id = 'a1723b8e521495001146543dabd2f5ff58e7b61d067f5fb0c5b86a7a028738bb'
AND (
token = 'EfiHNVfEux2m2o6E3abap7Aynab1Jg3D0m+jzPT6aVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)