UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Xl7xJsgQHOExRuATynwx8SOLF434/dwQm0lpj4UnLI=' 
WHERE 
  key_id = '16b168e5b51e27ba48f67e0fa8a3616bf34bcfbbf59216f69e0639135fe14341' 
  AND (
    token = '1Xl7xJsgQHOExRuATynwx8SOLF434/dwQm0lpj4UnLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033