UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zRLPG4CqDzgJmhke0lga2Mwwg8WwSOBl1Gh33sIKOfI='
WHERE
key_id = 'ed893d5fad6b71bc14541dcc2f22f83bc53877cc4424c391387afd6869f00396'
AND (
token = 'zRLPG4CqDzgJmhke0lga2Mwwg8WwSOBl1Gh33sIKOfI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)