UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHeMjQvmm+7hYc6y+dZYv01HjusD6SiZ1VcYOE3ji0s=' 
WHERE 
  key_id = '76d03793253580ae240ca6cd0f628dae4d708a56f8abb4fbb3d6100952aee512' 
  AND (
    token = 'dHeMjQvmm+7hYc6y+dZYv01HjusD6SiZ1VcYOE3ji0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042