UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NvgxC70Tre18We5R2Z5dyTlZ6q2qo1zqoE7hUg4sOdg=' 
WHERE 
  key_id = '18e0a3c2e48e899a6f5a03a3de7d342df7e371f70d757f2af70e3180bf3f3499' 
  AND (
    token = 'NvgxC70Tre18We5R2Z5dyTlZ6q2qo1zqoE7hUg4sOdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030