UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THIsUMln2oNrwKI+2D7biZCIszMNUmRGSPovPhco6tU=' 
WHERE 
  key_id = '18a7754c40dfca1bdc1dbe6a39cafa3ad4df684e394aff501553c800708138c6' 
  AND (
    token = 'THIsUMln2oNrwKI+2D7biZCIszMNUmRGSPovPhco6tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027