UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gUl60/8WbQnGA1NoDdRe1AZ7i79OAWchzom8j3aHfm4='
WHERE
key_id = '6f4ad57e63127e7fd4eb01fb63f12973860302e65c24c2032648057bf6eb4ab0'
AND (
token = 'gUl60/8WbQnGA1NoDdRe1AZ7i79OAWchzom8j3aHfm4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)