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

Query time 0.00047