UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9kPn/6mBIfsvkjAIj5yVEi2bHitMyWA1HJcSFkEVm+8='
WHERE
key_id = '659c6994f779d6e86e45785b99045ae3f9e9e96369698c4c8910808944a4e1dd'
AND (
token = '9kPn/6mBIfsvkjAIj5yVEi2bHitMyWA1HJcSFkEVm+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)