UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nqkwzhCpSAqrDrMQGPw9Kx9V1j1EgpuBVJolplbl9Zs=' 
WHERE 
  key_id = '0d34a28c573c4a04b9359c9e5b65a1e91b79bd8d2dcf6f563fdeafd657370fd9' 
  AND (
    token = 'nqkwzhCpSAqrDrMQGPw9Kx9V1j1EgpuBVJolplbl9Zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041