UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2LIzGaMhwNCOB5EsSsG8vdxbLX2qPXbv+kIrfHYguQ=' 
WHERE 
  key_id = 'b66c13c47d1ce50045e07402d54a09470cb2506d87aaea8f64cd25e8629e9fd8' 
  AND (
    token = 'E2LIzGaMhwNCOB5EsSsG8vdxbLX2qPXbv+kIrfHYguQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053