UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yxq5Rsdttpor83UB/p47tTQ91iS2Xrp14ykkP27OQsE=' 
WHERE 
  key_id = '7727a30059d72666164ff07d2358c826d103ed49942bde6856a4d4a37d0d7178' 
  AND (
    token = 'Yxq5Rsdttpor83UB/p47tTQ91iS2Xrp14ykkP27OQsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042