UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jDPTkg+wycJ+JkEjdV+rVW8NVMvsqv8wShzd77fvxLM=' 
WHERE 
  key_id = 'a5c9cacfea6b24a3d8312bde2a2625905a798b80996ad114273294236fb703b8' 
  AND (
    token = 'jDPTkg+wycJ+JkEjdV+rVW8NVMvsqv8wShzd77fvxLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020