UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mHM6Xd5Hr/dlL9/9cJNXSTMT+LHc2DCzvro/NknZeQQ=' 
WHERE 
  key_id = 'd8cc39e4e9c97e0885a3651b2c0999326e499eeda34083e83cb24098d20d8f8b' 
  AND (
    token = 'mHM6Xd5Hr/dlL9/9cJNXSTMT+LHc2DCzvro/NknZeQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035