UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2csyZP3IAHZkTLklJslsEIjhp3vpkDVjBRAh8eryYHU='
WHERE
key_id = '37d045ce575dd0c7c274175dd093ec827199c696ca052859cd10f2df441995bb'
AND (
token = '2csyZP3IAHZkTLklJslsEIjhp3vpkDVjBRAh8eryYHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)