UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i2di7elR8850mwx3YoFid83XpBifqos4rXo4pzGeKxM=' 
WHERE 
  key_id = '2437649f846e316064bcd4caa1dd8ee2614bd25c81ac46d237564fcd30619764' 
  AND (
    token = 'i2di7elR8850mwx3YoFid83XpBifqos4rXo4pzGeKxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042