UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OzRQrxGoEtwe+dP7IF9PSMjskFgeO4aDR8SkBscg8W4='
WHERE
key_id = '6baba43fe2befac27d650725404b1469867627b3159b61b327c317ff27066c4e'
AND (
token = 'OzRQrxGoEtwe+dP7IF9PSMjskFgeO4aDR8SkBscg8W4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)