UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j5QK4xJXitrxRsnCUCtHBwUcgL2M2EeoXyFz8+MCkiA=' 
WHERE 
  key_id = 'eec0f39bd89982362be311f8fcef5462411fd47553cbe7a7c823d3cec1892339' 
  AND (
    token = 'j5QK4xJXitrxRsnCUCtHBwUcgL2M2EeoXyFz8+MCkiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026