UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6T+OO9NgPlEFIX13mKyrBh10z+cMjXuQCBLJ7ADm4TQ='
WHERE
key_id = 'f0059ad41bfa59d337fbb2160c0b558687a9c49333d5cd1f9b487d33792628a7'
AND (
token = '6T+OO9NgPlEFIX13mKyrBh10z+cMjXuQCBLJ7ADm4TQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)