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

Query time 0.00038