UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0kzNryt6RObx1mKtkBVQCEZ9lUdPtd4sLo8Gtcs7pcE='
WHERE
key_id = '45ab4dcdcaef1c087775044a941466280653d9446eeb9877109bd14b502f0b4e'
AND (
token = '0kzNryt6RObx1mKtkBVQCEZ9lUdPtd4sLo8Gtcs7pcE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)