UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XQm1BpR1wgkNvlH7Hpt4MZNY/HeDQ8k3U3y5RSFpswk='
WHERE
key_id = '28d2ef82013183056691644225b037a6cbf5754c0c144ab0a7dca35a304926d3'
AND (
token = 'XQm1BpR1wgkNvlH7Hpt4MZNY/HeDQ8k3U3y5RSFpswk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)