UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uGdmJp4DmX2s0A7YrM7ffphvMssy13oEE7pCiUARMjQ=' 
WHERE 
  key_id = '06cf402239d97647a756f51f9c324e48f466118446f0354c442c01f0464bb16b' 
  AND (
    token = 'uGdmJp4DmX2s0A7YrM7ffphvMssy13oEE7pCiUARMjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040