UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X9bzC2SI5XOgSODMc3GettHpXPKC6hcdQxxecP3Zbj0=' 
WHERE 
  key_id = '1bb2e11fbe77b8f2f13d46c91821f9797ab252d371d01a8a140f737147efc82f' 
  AND (
    token = 'X9bzC2SI5XOgSODMc3GettHpXPKC6hcdQxxecP3Zbj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048