UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AJDy3fSKHt6An5Tf9EQzd9VZomD82m7AbSLc7YUFZ0Q='
WHERE
key_id = '092e364ca10067360ef86cb54db313a9cf823fd25ab9a77ea7760cfad622c299'
AND (
token = 'AJDy3fSKHt6An5Tf9EQzd9VZomD82m7AbSLc7YUFZ0Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)