UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P35EiWJaf/8hpaCdUp6u3+zmV3QOsRUZbb1pWCFkRko=' 
WHERE 
  key_id = 'a6c97bc7d980e2666f76c056ca1fa69107e30e784f905175a364d703b0c2f24b' 
  AND (
    token = 'P35EiWJaf/8hpaCdUp6u3+zmV3QOsRUZbb1pWCFkRko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044