UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DcYS/udh+fPSIwnCZ1ZmwiZoggrJmc2loLJYRR34+4Y=' 
WHERE 
  key_id = 'c84be3ffd73a3417ec63ea9e5cc1222f450be208c8cfb6dee443671939712bc7' 
  AND (
    token = 'DcYS/udh+fPSIwnCZ1ZmwiZoggrJmc2loLJYRR34+4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027