UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NwpdfW9kd7An8knvqSwFLqYRt4335PD9FY0B0ghuh30='
WHERE
key_id = '1b22367c271a93544ee059776ec22a1c3c15c6e381526b2b169f629e0499bfb7'
AND (
token = 'NwpdfW9kd7An8knvqSwFLqYRt4335PD9FY0B0ghuh30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)