UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/7VkeRHeaaIw1NT6tqgTmzs/Ahuyi/DQi5YA7YrinMc='
WHERE
key_id = 'd200cfc0d41d456f6c56ecbe54420766f89b388aa07284444b80e4e166b85c9c'
AND (
token = '/7VkeRHeaaIw1NT6tqgTmzs/Ahuyi/DQi5YA7YrinMc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)