UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9gkUSphCnI4nJSA5Gv7qyGalvMzQFhhPbC76iQxNR9o=' 
WHERE 
  key_id = 'd7c90a3226f858d405368f2312dcae478bb3ef41cd334019c352fb503342a0ee' 
  AND (
    token = '9gkUSphCnI4nJSA5Gv7qyGalvMzQFhhPbC76iQxNR9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032