UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dLyDHJ9TAEgh541qTmKBEGh3NHXS8rrtDOzOeU2i3XU='
WHERE
key_id = '7018f4fa64de30b9456ff02d070b987ee3e6f2395d35a894d93e10ef2f480666'
AND (
token = 'dLyDHJ9TAEgh541qTmKBEGh3NHXS8rrtDOzOeU2i3XU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)