UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cq38gM+L8p4vVwPiJCulL9dur3ip+kuC8JI50/C2vak=' 
WHERE 
  key_id = '473d95ec763dfdfedde7384b35ff2512a1901e631fddcea42d767a70091b88d8' 
  AND (
    token = 'Cq38gM+L8p4vVwPiJCulL9dur3ip+kuC8JI50/C2vak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045