UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tLCax+34qVZgXS8yLv+KbBVSTmJ55q0vPhyoWg6AQ6g='
WHERE
key_id = '9a58599e971845328e51e394560bd4d52d4afcfb2d77167f7275e3e16d0a40d5'
AND (
token = 'tLCax+34qVZgXS8yLv+KbBVSTmJ55q0vPhyoWg6AQ6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)