UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NjmGD86FRTXppKoEo1zx5tRxFQcfT3zlfHpdhuBTeEU=' 
WHERE 
  key_id = '09e1ec036b60368d2307f5131188b0093dae54dfe757db19a8080961d6334ed1' 
  AND (
    token = 'NjmGD86FRTXppKoEo1zx5tRxFQcfT3zlfHpdhuBTeEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036