UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pL5TwRYQWfbLaeKjLX53IBltrLrlmDTGirT0dAtA61g='
WHERE
key_id = 'd7fef2196407ec02dedfd08a67fa7ef13759ae8ce5622f6d590734903aa53d5c'
AND (
token = 'pL5TwRYQWfbLaeKjLX53IBltrLrlmDTGirT0dAtA61g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)