UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tG/7smgaXxEwFR/NJp0ghlrIBcLo44qImYg+PqidhVw=' 
WHERE 
  key_id = 'e94bbf9673c3fca40b050b85ed3aa97e2289568e95f7d560f7772adc3cd433e0' 
  AND (
    token = 'tG/7smgaXxEwFR/NJp0ghlrIBcLo44qImYg+PqidhVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00098