UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JA996jmcTzDUn2jiIOynW6broXNiK1rck13WlqcBnJw='
WHERE
key_id = '8b81f48dadd94ca63a631b7d63d3b93ff0e14a01e95e3f3a875743159d15196b'
AND (
token = 'JA996jmcTzDUn2jiIOynW6broXNiK1rck13WlqcBnJw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)