UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PYqOUqiDhYzdYcqbDyGpFnhl2x6s1UuNcu4FMO8cpFE='
WHERE
key_id = '597e7558ca4ed2293156dafa26eea82be4d15b62d46566e1daa1687e5d2f5c8a'
AND (
token = 'PYqOUqiDhYzdYcqbDyGpFnhl2x6s1UuNcu4FMO8cpFE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)