UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tO9o1OAQE3C48+z7ThiUdcBs8Lff8GzRBcalj5Yoq+g=' 
WHERE 
  key_id = '8fba574957856beb3326f7569e519a59e154acb5d276de6f32cb1cc6d94af4e1' 
  AND (
    token = 'tO9o1OAQE3C48+z7ThiUdcBs8Lff8GzRBcalj5Yoq+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033