UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v6gbcmAr4cJu0t/5lImwezgnIn2uQ3CtnKNGLMXFBWc=' 
WHERE 
  key_id = '6bc0f7790d73a5cd3e51c2dd2ffe61a17a33223d8e056df983fe446a6ac51754' 
  AND (
    token = 'v6gbcmAr4cJu0t/5lImwezgnIn2uQ3CtnKNGLMXFBWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046