UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3mHbKrs5FlGPZOCnJC1HWuELKEDfNZFx9cHzmqElsbY='
WHERE
key_id = '6395427fc35aa3b14618ebc4188ae352c5de05cfb12239f8fb3390d592e7d951'
AND (
token = '3mHbKrs5FlGPZOCnJC1HWuELKEDfNZFx9cHzmqElsbY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)