UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5gFPsVmuxSdKFBtBlPJqzgmUM8cAekEBhJj1d/5/Sg=' 
WHERE 
  key_id = '3c13e68be45f89a0506895c4df9551879e514f202410b9ad9ff06bc4b4b92087' 
  AND (
    token = 'N5gFPsVmuxSdKFBtBlPJqzgmUM8cAekEBhJj1d/5/Sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032